package crm.view.masterMagment;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.SpringLayout;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;

public class MasterManagment extends JPanel
{
	private JTextField tfName;
	private JButton btnSave;
	private JButton btnUpdate;
	private JButton btnBack;
	private JButton btnSearch;
	private JButton btnForward;
	private JButton btnClear;
	private JLabel lblStatus;
	private JButton btnStatus;
	//private JLabel lblPriorityStatus;
	private JButton[] buttongrp=new JButton[7];
	private JLabel lblName;
	public MasterManagment()
	{
		setBorder(new TitledBorder(null, "Managment", TitledBorder.LEADING, TitledBorder.TOP, null, Color.DARK_GRAY));
		SpringLayout springLayout = new SpringLayout();
		setLayout(springLayout);
		this.setBackground(Color.LIGHT_GRAY);
	    this.setPreferredSize(new Dimension(360, 620));
		
		
		
		lblName = new JLabel("Name:");
		springLayout.putConstraint(SpringLayout.NORTH, lblName, 50, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.WEST, lblName, 47, SpringLayout.WEST, this);
		add(lblName);
		
		tfName = new JTextField();
		springLayout.putConstraint(SpringLayout.WEST, tfName, 0, SpringLayout.WEST, lblName);
		add(tfName);
		tfName.setColumns(10);
		
		/*lblPriorityStatus = new JLabel("Campaign Status :");
		lblPriorityStatus.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblPriorityStatus, 8, SpringLayout.SOUTH, this);
		springLayout.putConstraint(SpringLayout.EAST, lblPriorityStatus, 0, SpringLayout.EAST, this);
		add(lblPriorityStatus);*/
		
		lblStatus = new JLabel("XYZ");
		lblStatus.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblStatus, 6, SpringLayout.NORTH,this);
		springLayout.putConstraint(SpringLayout.WEST, lblStatus, 10, SpringLayout.WEST, this);
		add(lblStatus);
		
		btnStatus = new JButton("Mark Deactivate");
		springLayout.putConstraint(SpringLayout.NORTH, btnStatus, 139, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.SOUTH, tfName, -27, SpringLayout.NORTH, btnStatus);
		springLayout.putConstraint(SpringLayout.WEST, btnStatus, 29, SpringLayout.WEST, this);
		btnStatus.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		add(btnStatus);
		
		
		
		JPanel panel = new JPanel();
		springLayout.putConstraint(SpringLayout.NORTH, panel, 10, SpringLayout.SOUTH, btnStatus);
		springLayout.putConstraint(SpringLayout.WEST, panel, 30, SpringLayout.WEST,this);
		add(panel);
		panel.setPreferredSize(new Dimension(300, 100));
		GridLayout g=new GridLayout(2,3,2,2);
		panel.setLayout(g);

		btnSave = new JButton("Save");
		btnSave.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		panel.add(btnSave);
		btnSave.setActionCommand("SAVE");
		buttongrp[0]=btnSave;
		
		btnClear = new JButton("Clear");
		btnClear.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		panel.add(btnClear);
		btnClear.setActionCommand("CLEAR");
		buttongrp[1]=btnClear;
		
		btnUpdate = new JButton("Update");
		btnUpdate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		panel.add(btnUpdate);
		btnUpdate.setActionCommand("UPDATE");
		buttongrp[2]=btnUpdate;
		
		btnBack = new JButton("  <<  ");
		btnBack.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		panel.add(btnBack);
		btnBack.setActionCommand("<< ");
		buttongrp[3]=btnBack;
		
		btnSearch = new JButton("Search");
		btnSearch.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		panel.add(btnSearch);
		btnSearch.setActionCommand("SEARCH");
		buttongrp[4]=btnSearch;
		
		btnForward = new JButton(">>");
		btnForward.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		panel.add(btnForward);
		btnForward.setActionCommand(">>");
		buttongrp[5]=btnForward;
		
		buttongrp[6]=btnStatus;
		buttongrp[6].setActionCommand("status");
		
	}
	public JTextField getTfName() {
		return tfName;
	}
	public void setTfName(JTextField tfName) {
		this.tfName = tfName;
	}
	public JButton getBtnSave() {
		return btnSave;
	}
	public void setBtnSave(JButton btnSave) {
		this.btnSave = btnSave;
	}
	public JButton getBtnUpdate() {
		return btnUpdate;
	}
	public void setBtnUpdate(JButton btnUpdate) {
		this.btnUpdate = btnUpdate;
	}
	public JButton getBtnBack() {
		return btnBack;
	}
	public void setBtnBack(JButton btnBack) {
		this.btnBack = btnBack;
	}
	public JButton getBtnSearch() {
		return btnSearch;
	}
	public void setBtnSearch(JButton btnSearch) {
		this.btnSearch = btnSearch;
	}
	public JButton getBtnForward() {
		return btnForward;
	}
	public void setBtnForward(JButton btnForward) {
		this.btnForward = btnForward;
	}
	public JButton getBtnClear() {
		return btnClear;
	}
	public void setBtnClear(JButton btnClear) {
		this.btnClear = btnClear;
	}
	public JButton getBtnStatus() {
		return btnStatus;
	}
	public void setBtnStatus(JButton btnStatus) {
		this.btnStatus = btnStatus;
	}
	public JButton[] getButtongrp() {
		return buttongrp;
	}
	public void setButtongrp(JButton[] buttongrp) {
		this.buttongrp = buttongrp;
	}
	
	public JLabel getLblStatus() {
		return lblStatus;
	}
	public void setLblStatus(JLabel lblStatus) {
		this.lblStatus = lblStatus;
	}
	
	
	
	public JLabel getLblName() {
		return lblName;
	}
	public void setLblName(JLabel lblName) {
		this.lblName = lblName;
	}
	public void actionListener(ActionListener al)
	{
		for(int i=0;i<buttongrp.length;i++)
		{
			buttongrp[i].addActionListener(al);
			
		}
	}
	

}
